package xiegd.com.springbootuse.demo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import javax.validation.constraints.Digits;
import java.math.BigDecimal;

/**
 * @Description:
 * @Author: xieguangda
 * @Date: 2021年07月19日 9:56
 */
@RestController
//@RequestMapping("/arthas")
public class ArthasController {


    @PostMapping("/arthas/getArthasTest1")
    @ResponseBody
    public String getArthasTest1(@RequestBody String arthas) throws Exception{

        int a = 3;
        int b = 4;
        int c = a + b;
        Thread.sleep(1000);
        return arthas;
    }


    @PostMapping("/arthas/getArthasTest2")
    @ResponseBody
    public String getArthasTest2(@RequestBody String arthas) throws Exception{

        int a = 6;
        int b = 7;
        int c = a + b;
        Thread.sleep(1000);
        return arthas + "::::" + c;
    }

    @PostMapping("/mytest002")
    @ResponseBody
    public String newTest(@RequestBody @Valid BigData b) throws Exception{

        System.out.println("我笨访问了 " + b);
        return  "";
    }
}
@Data
@AllArgsConstructor
@NoArgsConstructor
@Valid
class BigData{
    @Digits(integer = 3,fraction = 2)
    private BigDecimal b;
}
